home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power CD-ROM!! 8
/
Power CD-ROM 8.iso
/
prgmming
/
pmd110
/
assertio.pas
next >
Wrap
Pascal/Delphi Source File
|
1994-11-13
|
1KB
|
38 lines
(* This file was mangled by Mangler 1.35 (c) Copyright 1993-1994 by Berend de Boer *)
{ Created : 1994-02-26 (c) Copyright 1994 by Berend de Boer
Assertions for Pascal. Use a compiler directive like DEBUG to enable or
disable portions of your code.
Install the Post Mortem Debugger to be able to fully use it.
Last changes :
94-09-21 Changed Assert so that it does not call PrintError anymore, but
only writes a message and stacktrace to the log file and terminates
the program.
}
{$IFDEF MsDos}
{$F+,O+}
{$ENDIF}
{$S-,R-,Q-}
unit Assertions;
interface
procedure Assert(Success : Boolean; const Msg : string);
procedure Warning(Success : Boolean; const Msg : string);
IMPLEMENTATION USES BBERROR , BBGUI ;PROCEDURE ASSERT (SUCCESS:BOOLEAN;CONST MSG:STRING );VAR O100llIl00IOl:WORD;
BEGIN ASM {} MOV O100llIl00IOl, BP {} END;IF NOT SUCCESS THEN BEGIN LOGERROR ('Assertion failed: '#39+ MSG + #39'.');
DUMPSTACK (NIL , O100llIl00IOl );HALT (1 );END ;END ;PROCEDURE WARNING (SUCCESS:BOOLEAN;CONST MSG:STRING );BEGIN IF NOT
SUCCESS THEN PRINTERROR ('Warning failed: '#39+ MSG + #39'.', 0 );END ;END .